* {
   margin: 0;
   padding: 0;
}

#tab li {
   float: left;
   list-style: none;
}

#tab li a {
   display: inline-block;
   text-decoration: none;
   width: 80px;
   height: 40px;
   line-height: 40px;
   text-align: center;
   color: #000;
}

#container {
   position: relative;
}

#content1,
#content2,
#content3 {
   width: 300px;
   height: 100px;
   padding: 30px;
   position: absolute;
   top: 40px;
   left: 0;
}

#tab li:first-child,
#content1 {
   background-color: #ffcc00;
}

#tab li:first-child+li,
#content2 {
   background-color: #ff00cc;
}

#tab li:first-child+li+li,
#content3 {
   background-color: #00ccff;
}